<template>
  <div>
    <h2>物流相关信息</h2>
    <div class="logistics-info-header">
      <div class="logistics-info-header-left">
        <div class="logistics-status blue" ref="abc">{{lll()}}</div>
        <div class="logistics-company">顺丰速运</div>
        <div class="logistics-no">SF123456789</div>
      </div>
    </div>
    <ul class="logistics-info-list">
      <li v-for="item in  orderInfo" :key="item.time">
        <div class="logistics-info-list-time">{{item.time}}</div>
        <div class="logistics-info-list-content">{{item.content}}</div>
      </li>
    </ul>
    <button v-role="orderInfo.role">查看物流详情</button>
  </div>
</template>

<script>
export default {
  props:{
    orderInfo:{
      type:Array,
      require: true
    },
    orderIn:Number
  },
  methods: {
    lll(){
      if(this.orderIn === 0){
        this.$refs.abc.innerText = '未发货'
      }else if(this.orderIn === 1){
        this.$refs.abc.innerText = '发货'
      }else if(this.orderIn === 2){
        this.$refs.abc.innerText = '货'
      }
    }
  },
  directives:{
    role:{
      inserted(el,{value}){
        const res = ['abmin', 'zhangsan'].includes(value)
        el.disdbled8 = !res
      }
    }
  }
}
</script>

<style scoped lang="less">
.logistics-info-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
}

.logistics-info-header-left {
  display: flex;
  align-items: center;
}

.logistics-status {
  font-weight: bold;
  font-size: 16px;
  color: #007bff;
}

.logistics-company,
.logistics-no {
  margin-left: 10px;
  font-size: 14px;
  color: #333;
}

.logistics-info-list {
  list-style: none;
  padding: 0;
  margin: 0;
  max-height: 230px;
  overflow-y: auto;
}

.logistics-info-list li {
  display: flex;
  margin-bottom: 10px;
}

.logistics-info-list-time {
  font-size: 12px;
  color: #999;
  width: 80px;
  text-align: right;
  margin-right: 10px;
}

.logistics-info-list-content {
  font-size: 14px;
  color: #333;
}
</style>
